package com.whq.thrift.api.web.base.serviceconf.db;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

public interface UrlMappingInfoMapper {

	@Insert("INSERT INTO t_url_mapping " + " (url, map_param_method, create_time, update_time) " + " VALUES "
			+ " (#{url}, #{mapParamMethod}, #{createTime}, #{updateTime})")
	public void addUrlMappingInfo(UrlMappingInfo urlMappingInfo);

	@Delete("delete from t_url_mapping where url=#{url}")
	public void deleteUrlMappingInfo(@Param("url") String url);

	@UpdateProvider(type = UrlMappingInfoSqlProvider.class, method = "updateSql")
	public void updateUrlMappingInfo(UrlMappingInfo urlMappingInfo);

	@SelectProvider(type = UrlMappingInfoSqlProvider.class, method = "getSelectUrlMappingInfoSql")
	@Results(value = { @Result(property = "url", column = "url"), @Result(property = "mapParamMethod", column = "map_param_method"),
			@Result(property = "createTime", column = "create_time"), @Result(property = "updateTime", column = "update_time") })
	public List<UrlMappingInfo> findUrlMappingInfoByMap(@Param("url") String url, @Param("beginIndex") int beginIndex, @Param("maxCount") int maxCount);

	@SelectProvider(type = UrlMappingInfoSqlProvider.class, method = "getSelectCountSql")
	public int findUrlMappingInfoCount(@Param("url") String url);

	@Select("select * from t_url_mapping where url=#{url}")
	@Results(value = { @Result(property = "url", column = "url"), @Result(property = "mapParamMethod", column = "map_param_method"),
			@Result(property = "createTime", column = "create_time"), @Result(property = "updateTime", column = "update_time") })
	public UrlMappingInfo findUrlMappingInfo(@Param("url") String url);

	@SelectProvider(type = UrlMappingInfoSqlProvider.class, method = "findAllUrlMappingInfo")
	@Results(value = { @Result(property = "url", column = "url"), @Result(property = "mapParamMethod", column = "map_param_method"),
			@Result(property = "createTime", column = "create_time"), @Result(property = "updateTime", column = "update_time") })
	public List<UrlMappingInfo> findAllUrlMappingInfo();
}
